import request from '@/utils/request'

const api_name = '/system/sysMenu'

export default {
  /**
   * 获取全部的菜单
   */
  getMenu(){
    return request({
      url :`${api_name}/menu`,
      method: 'get'
    })
  },
  removeById(id){
    return request({
      url: `${api_name}/delete/${id}`,
      method: 'delete'
    })
  },
  /**
   *  保存 菜单
   */
  save(sysMenu){
    return request({
      url: `${api_name}/save`,
      method: 'post',
      data: sysMenu
    })
  },
  /**
   * 修改菜单
   */
  update(sysMenu){
    return request({
      url: `${api_name}/update`,
      method: 'put',
      data: sysMenu
    })
  },
  /**
   * 查看角色对应的菜单
   */
  findRoleMenu(roleId){
    return request({
      url: `${api_name}/roleMenu/${roleId}`,
      method: 'get'
    })
  },
  /**
   * 保存角色的菜单权限
   */
  saveRoleMenu(RoleMenu){
    return request({
      url: `${api_name}/saveRoleMenu`,
      method: 'post',
      data: RoleMenu
    })
  }
}
